*************************************************************************
* Institutional overlap in global governance (RIO-21-00123)
* 
* 10-December-2022
* Contact: bernhard.reinsberg@glasgow.ac.uk 
*************************************************************************

* Data and variables 
********************************************************************************

  use "PIGFIG_RIO_dyads", clear
  

* Variables 

  g GIij=Gij*Iij
  
  g lnni=ln(1+ni)
  g lnnj=ln(1+nj)
  g lnsi=ln(1+stasysi)
  g lnsj=ln(1+stasysj)
  g majndij=majni-majnj
  g polmeandij=polmeani-polmeanj
  g idealmeandij=idealmeani-idealmeanj
  g lnndij=lnni-lnnj
  egen nissuej=rowtotal(i_*j)
  egen ngovj=rowtotal(g_*j)

  g period=0
  forvalues k=1/7{
   replace period=`k' if (strti>=1945+10*(`k'-1) & strti<=1954+10*(`k'-1))
   }
  replace period=7 if strti>=2014

  
  qui xi:reg ds5 i.regi i.period i.iid 

  global A issuenij regij _Iperiod* _Iiid*
  global AOLS issuenij regij i_*i g_*i  lnni lnsi _Iperiod* 
  global B  strtj majnj lnnj
  global C  majndij idealmeandij 
  global D  idealsdi lnmeangdpi lnsdgdpi polmeani polsdi 
 
  global ZA zissuenij zregij _Iperiod* _Iiid*
  global ZB zstrtj zmajnj zlnnj
  global ZC zmajndij zidealmeandij
  
  cmp setup 
  set matsize 800 
  sort iid jid 
  
  
* Main analysis
********************************************************************************

* Figures

** Figure 1 **
  graph box ds5, over(period, label(angle(90)) relabel(1 "1815-1944" 2 "1945-54" 3 "1955-64" 4 "1965-74" 5 "1975-84" 6 "1985-94" 7 "1995-2004" 8"2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity)   

** Figure 2 **
  lgraph MGIij period if period>=1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 0.03)) ylabel(0(0.01)0.03)

** Figure 3 **
  twoway (scatter ds5 MGIij) (lfit ds5 MGIij), scheme(s1mono) xtitle(IGO overlap) ytitle(IGO design similiarity) legend(off)

  
* Tables

* Overlap and design similarity
  
  qui reg ds5 MGIij $A, cl(iid)
  est store a11
  qui reg ds5 MGIij $A $B, cl(iid)
  est store a12
  qui reg ds5 MGIij $A $B $C, cl(iid)
  est store a13
  
** Table 1 **  
estout a1*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))


* Overlap with (un)successful IGOs

  g deadatstart=endj<strti

  qui reg ds5 MGIij $A if deadatstart==0, cl(iid)
  est store a21
  qui reg ds5 MGIij $A $B if deadatstart==0, cl(iid)
  est store a22
  qui reg ds5 MGIij $A $B $C if deadatstart==0, cl(iid)
  est store a23
  qui reg ds5 MGIij $A if deadatstart==1, cl(iid)
  est store a24
  qui reg ds5 MGIij $A $B if deadatstart==1, cl(iid)
  est store a25
  qui reg ds5 MGIij $A $B $C if deadatstart==1, cl(iid)
  est store a26
    
** Table 2 **
estout a2*, starlevels(° .1 * .05 ** .01 *** .001) cells(b(star fmt(3)) se(par fmt(3))) drop(_*) stat(N r2, fmt(0 3))


* Splitting up overlap dimensions

  qui reg ds5 Mij GIij $A, cl(iid)
  est store a31
  qui reg ds5 Mij GIij $A $B, cl(iid)
  est store a32
  qui reg ds5 Mij GIij $A $B $C, cl(iid)
  est store a33

** Table 3 **
estout a3*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))


* Supplemental appendix
********************************************************************************

* Variables 

  g MpGIij=majpow_ij*Gij*Iij

  g vrmaji=(vrulei==1|vrulei==2) if vrulei<9
  g vrmajj=(vrulej==1|vrulej==2) if vrulei<9
  g dsBP=(d_sec_indi*d_sec_indj+vrmaji*vrmajj+d_moni*d_monj+d_enfi*d_enfj+d_dspi*d_dspj)/(sqrt(d_sec_indi+vrmaji+d_moni+d_enfi+d_dspi)*sqrt(d_sec_indj+vrmajj+d_monj+d_enfj+d_dspj))
  
  g Jij=1/5*((d_sec_indi==d_sec_indj)+(d_voti==d_votj)+(d_moni==d_monj)+(d_enfi==d_enfj)+(d_dspi==d_dspj))
    
  g polity_cov2=(polity_cov*polity_m)/(polity_m+10)

  egen nissuei=rowtotal(i_*i)
  g ambig=(nissuei==1)
  
  g global=(regi==0)
  g postcw=(strti>1990)
  g g7any=(g7ni>0)
  
  egen cow2=rowmax(var_10a var_10b var_12 var_14)
  
  
* Figures

  ** Finance 
  preserve
    g s=i_fini
	keep if i_finj==1
    graph box ds5 if s==1 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if s==1 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 0.1)) ylabel(0(0.02)0.1)
  restore
  
  ** Development 
  preserve 
    g s=i_devi
	keep if i_devj==1
 	graph box ds5 if s==1 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if s==1 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 0.1)) ylab(0(0.02)0.1)	
  restore
  
  ** Trade
  preserve
    g s=i_trai
	keep if i_traj==1
 	graph box ds5 if s==1 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if s==1 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 0.1)) ylab(0(0.02)0.1)	
  restore
  
  ** Environment
  preserve
    g s=i_envi
	keep if i_envj==1
    graph box ds5 if s==1 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if s==1 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 0.1)) ylab(0(0.02)0.1)
  restore	
  
  ** Geographical scope
  g globali=(regi==0)
  g globalj=(regj==0)
  
  preserve
	keep if globalj==0
	graph box ds5 if globali==0 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if globali==0 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 0.1)) ylab(0(0.02)0.1)
  restore 
  
  preserve
	keep if globalj==1
    graph box ds5 if globali==1 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if globali==1 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysca(r(0 .1)) ylabel(0(0.02)0.1)
  restore 
  
  ** Interventionist IGO **
  preserve
	keep if intvj==0
    graph box ds5 if intvi==0 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if intvi==0 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 0.1)) ylabel(0(0.02)0.01)
  restore 
  
  preserve
	keep if intvj==1
    graph box ds5 if intvi==1 & period>=1, over(period, label(angle(90)) relabel(1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14")) legend(lab(1 "IGO design similarity")) nooutside scheme(s1mono) note(" ") ytitle(IGO design similarity) 
	lgraph MGIij period if intvi==1 & period>1, err(ci(95)) lop(recast(scatter)) scheme(s1mono) xlabel(2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14") xtitle(" ") ytitle(Average IGO overlap) ysc(r(0 .18)) ylabel(0(0.02)0.18)
  restore 

* Figures to collect from subsamples above
  
** Figure A1 **  
** Figure A2 **
** Figure A3 **
** Figure A4 **
** Figure A5 **
** Figure A6 **


* Scatter of overlap dimensions

preserve 
  collapse (mean)MGIij Mij GIij ds5, by(iid)

  ** Figure A7 **
  twoway scatter (Mij GIij), scheme(s1mono) xtitle(Average functional overlap) ytitle(Average membership overlap)
restore	


* Evaluation of denominators

preserve
  g deni=sqrt((i_seci^2+i_fini^2+i_trai^2+i_envi^2+i_heai^2+i_hri^2+i_soci^2+i_techi^2)*(i_secj^2+i_finj^2+i_traj^2+i_envj^2+i_heaj^2+i_hrj^2+i_socj^2+i_techj^2))
  g deng=sqrt((g_seti^2+g_impi^2+g_moni^2+g_fundi^2+g_capi^2+g_seri^2+g_ageni^2+g_infi^2)*(g_setj^2+g_impj^2+g_monj^2+g_fundj^2+g_capj^2+g_serj^2+g_agenj^2+g_infj^2))
  collapse (mean)deni deng denm, by(period)
  g i=deni/1.223
  g g=deng/2.6056
  g m=denm/45.024

  ** Figure A8 **    
  twoway (connected m i g period), scheme(s1mono) ytitle("Index value of denominators") xlab(0 "1815-1944" 1 "1945-54" 2 "1955-64" 3 "1965-74" 4 "1975-84" 5 "1985-94" 6 "1995-2004" 7 "2005-14 ") yscale(range(1.0 2.0)) ylabel(0.0(0.25)2.0, angle(0)) xtitle(" ") legend(lab(1 "Common membership") lab(2 "Issue areas") lab(3 "Governance tasks"))
restore
  

* Model diagnostics 

  qui reg ds5 MGIij $A $B $C, cl(iid)
  predict re, res
  
  ** Figure A9 **
  pnorm re, scheme(s1mono)


* Tables 

preserve

  use "PIGFIG_RIO_monads", clear
	
** Table A1 **
  qui estpost su d_* issue_* govt*
  esttab ., cells("count mean sd min max") noobs
  
** Table A2 **  
  factor d_sec_ind d_vot d_mon d_enf d_dsp, fa(1) 
			
restore			


** Table A3 **
corr Mij Gij Iij


** Table A4 **
factor Mij Gij Iij


** Table A5 **
gsort -MGIij
list iid shorti jid shortj MGIij Mij Gij Iij in 1/20
sort iid jid 
	
  
** Table A6 **  
qui estpost su ds5 Mij Gij Iij MGIij 
esttab ., cells("count mean sd min max") noobs


** Table A7 **
qui estpost su ds5 dsIMED dsBP dsIVED Jij Mij Gij Iij MGIij MGij MpGIij $AOLS $B $C deadatstart progeny polity_cov2 global ambig g7any postcw cow2 
esttab ., cells("count mean sd min max") noobs


* Substantive analyses

  qui reg ds5 MGIij $A if dead_clean==0, cl(iid)
  est store r11
  qui reg ds5 MGIij $A $B if dead_clean==0, cl(iid)
  est store r12
  qui reg ds5 MGIij $A $B $C if dead_clean==0, cl(iid)
  est store r13
  qui reg ds5 MGIij $A if dead_clean==1, cl(iid)
  est store r14
  qui reg ds5 MGIij $A $B if dead_clean==1, cl(iid)
  est store r15
  qui reg ds5 MGIij $A $B $C if dead_clean==1, cl(iid)
  est store r16
  
** Table A8 **
estout r1*, starlevels(° .1 * .05 ** .01 *** .001) cells(b(star fmt(3)) se(par fmt(3))) drop(_*) stat(N r2, fmt(0 3))


  foreach h in trai envi fini devi{
   qui reg ds5 MGIij $A $B $C if i_`h'==1
   est store r`h'1
   qui reg ds5 Mij GIij $A $B $C if i_`h'==1
   est store r`h'2
  }
  
** Table A9 **
estout r*tr*1 r*en*1 r*fi*1 r*de*1, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*iid* _cons) stat(N r2, fmt(0 3))
 
** Table A10 **
estout r*tr*2 r*en*2 r*fi*2 r*de*2, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*iid* _cons) stat(N r2, fmt(0 3))


  qui reg ds5 MGij $A if Iij>0, cl(iid)
  est store r21
  qui reg ds5 MGij $A $B if Iij>0, cl(iid)
  est store r22
  qui reg ds5 MGij $A $B $C if Iij>0, cl(iid)
  est store r23
  
** Table A11 **
estout r2*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*iid* _cons) stat(N r2, fmt(0 3))


  qui reg ds5 MpGIij $A, cl(iid)
  est store r31
  qui reg ds5 MpGIij $A $B, cl(iid)
  est store r32
  qui reg ds5 MpGIij $A $B $C, cl(iid)
  est store r33

** Table A12 **
estout r3*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))


  g lnMGIij=(1+MGIij)
  qui reg ds5 lnMGIij $A, cl(iid)
  est store r41
  qui reg ds5 lnMGIij $A $B, cl(iid)
  est store r42
  qui reg ds5 lnMGIij $A $B $C, cl(iid)
  est store r43

** Table A13 **
estout r4*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))
 

  qui reg ds5 MGIij Mij Iij $A, cl(iid)
  est store r51
  qui reg ds5 MGIij Mij Iij $A $B, cl(iid)
  est store r52
  qui reg ds5 MGIij Mij Iij $A $B $C, cl(iid)
  est store r53

** Table A14 **
estout r5*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))
 
 
  qui reg dsIMED MGIij $A, cl(iid)
  est store r61
  qui reg dsIMED MGIij $A $B, cl(iid)
  est store r62
  qui reg dsIMED MGIij $A $B $C, cl(iid)
  est store r63

** Table A15 **
estout r6*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))

 
  qui reg dsBP MGIij $A, cl(iid)
  est store r71
  qui reg dsBP MGIij $A $B, cl(iid)
  est store r72
  qui reg dsBP MGIij $A $B $C, cl(iid)
  est store r73
  
** Table A16 **
estout r7*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))


  qui reg dsIVED MGIij $A, cl(iid)
  est store r81
  qui reg dsIVED MGIij $A $B, cl(iid)
  est store r82
  qui reg dsIVED MGIij $A $B $C, cl(iid)
  est store r83

** Table A17 **
estout r8*, starlevels(° .1 * .05  ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))


  qui reg Jij MGIij $A, cl(iid)
  est store r91
  qui reg Jij MGIij $A $B, cl(iid)
  est store r92
  qui reg Jij MGIij $A $B $C, cl(iid)
  est store r93
 
** Table A18 **
estout r9*, starlevels(° .1 * .05  ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))

 
  foreach y in sec_ind vot mon enf dsp{
   g sim`y'=d_`y'i==d_`y'j & d_`y'i==1
   }
  
  qui reg simsec_ind MGIij $A $B if d_sec_indi+d_sec_indj>0, cl(iid)
  est store s11
  qui reg simvot MGIij $A $B if d_voti+d_votj>0, cl(iid)
  est store s12
  qui reg simmon MGIij $A $B if d_moni+d_monj>0, cl(iid)
  est store s13
  qui reg simenf MGIij $A $B if d_enfi+d_enfj>0, cl(iid)
  est store s14
  qui reg simdsp MGIij $A $B if d_dspi+d_dspj>0, cl(iid)
  est store s15
 
** Table A19 **
estout s1*, starlevels(° .1 * .05  ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))
 
 
  qui reg simsec_ind Gij $A $B if d_sec_indi+d_sec_indj>0, cl(iid)
  est store s21
  qui reg simvot Gij $A $B if d_voti+d_votj>0, cl(iid)
  est store s22
  qui reg simmon Gij $A $B if d_moni+d_monj>0, cl(iid)
  est store s23
  qui reg simenf Gij $A $B if d_enfi+d_enfj>0, cl(iid)
  est store s24
  qui reg simdsp Gij $A $B if d_dspi+d_dspj>0, cl(iid)
  est store s25
    
** Table A20 **
estout s2*, starlevels(° .1 * .05  ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))


  forvalues t=1/14{
   g _T_`t'=strti>=1945+5*(`t'-1) & strti<=1949+5*(`t'-1)
   } 
  
  qui reg ds5 MGIij _T* $A, cl(iid)
  est store s31
  qui reg ds5 MGIij _T* $A $B, cl(iid)
  est store s32
  qui reg ds5 MGIij _T* $A $B $C, cl(iid)
  est store s33
  
** Table A21 **
estout s3*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* ) stat(N r2, fmt(0 3))


  qui reg ds5 MGIij i.strti $A, cl(iid)
  est store s41
  qui reg ds5 MGIij i.strti $A $B, cl(iid)
  est store s42
  qui reg ds5 MGIij i.strti $A $B $C, cl(iid)
  est store s43

** Table A22 **
estout s4*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* *.strt*) stat(N r2, fmt(0 3))


  qui reg ds5 MGIij $ZA, cl(iid)
  est store s51
  qui reg ds5 MGIij $ZA $ZB, cl(iid)
  est store s52
  qui reg ds5 MGIij $ZA $ZB $ZC, cl(iid)
  est store s53
  
** Table A23 **
estout s5*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* ) stat(N r2, fmt(0 3))

  
  qui reg ds5 MGIij $ZA if deadatstart==0, cl(iid)
  est store s61
  qui reg ds5 MGIij $ZA $ZB if deadatstart==0, cl(iid)
  est store s62
  qui reg ds5 MGIij $ZA $ZB $ZC if deadatstart==0, cl(iid)
  est store s63
  qui reg ds5 MGIij $ZA if deadatstart==1, cl(iid)
  est store s64
  qui reg ds5 MGIij $ZA $ZB if deadatstart==1, cl(iid)
  est store s65
  qui reg ds5 MGIij $ZA $ZB $ZC if deadatstart==1, cl(iid)
  est store s66
  
** Table A24 **
estout s6*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* ) stat(N r2, fmt(0 3))


preserve

  use "PIGFIG_RIO_dyads_proposals", clear
  xtset iid jid 
  
  qui xi:reg create i.regi i.iid i.period
  global A  issuenij regij _Iperiod* _Iiid*
  global AOLS issuenij regij i_*i g_*i lnni strti lnsi 
  global B  strtj majnj lnnj
  global C  majndij idealmeandij 
  
  mat D=J(5,3,0)
  qui cmp (create=newi MGIij $AOLS) (ds5=MGIij $A), indicators($cmp_probit create) ro cl(iid) iterate(40) difficult tech(dfp nr)
  est store t11
   mat D[1,1]=e(N1)
   mat D[4,1]=e(N2)
   qui test [create]newi
   mat D[3,1]=r(chi2)
   qui probit create newi MGIij $AOLS
   mat D[2,1]=e(r2_p)
   qui xtreg ds5 MGIij $A if create, fe 
   mat D[5,1]=e(r2_w)
   
  qui cmp (create=newi MGIij $AOLS $B) (ds5=MGIij $A $B), indicators($cmp_probit create) ro cl(iid) iterate(80) difficult tech(dfp nr)
  est store t12
   mat D[1,2]=e(N1)
   mat D[4,2]=e(N2)
   qui test [create]newi
   mat D[3,2]=r(chi2)
   qui probit create newi MGIij $AOLS $B 
   mat D[2,2]=e(r2_p)
   qui xtreg ds5 MGIij $A $B if create, fe 
   mat D[5,2]=e(r2_w)
   
  qui cmp (create=newi MGIij $AOLS $B $C) (ds5=MGIij $A $B $C), indicators($cmp_probit create) ro cl(iid) iterate(40) difficult tech(dfp nr)
  est store t13
   mat D[1,3]=e(N1)
   mat D[4,3]=e(N2)
   qui test [create]newi
   mat D[3,3]=r(chi2)
   qui probit create newi MGIij $AOLS $B $C 
   mat D[2,3]=e(r2_p)
   qui xtreg ds5 MGIij $A $B $C if create, fe 
   mat D[5,3]=e(r2_w)

** Table A25 **   
  estout t1*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) keep(newi* MGIij lnni strti lnsi issuenij regij $B $C) order(MGIij) stats(N1 N2 converged, fmt(%7.0f %7.0f %7.0f))
  mat li D

restore
  

  global A issuenij regij _Iperiod* _Iiid*
  global AOLS issuenij regij i_*i g_*i  lnni lnsi _Iperiod*
 
  global B  strtj majnj lnnj
  global C  majndij idealmeandij 
  global D  idealsdi lnmeangdpi lnsdgdpi polmeani polsdi 
 
  g lnnew=ln(1+newi)
  g lnnew2=ln(1+newi^2)
  
  qui reg ds5 MGIij issuenij regij i_*i g_*i _Iregi* _Iperiod* $B, cl(iid)
  est store t21
  qui reg ds5 MGIij lnnew* issuenij regij i_*i g_*i _Iregi* _Iperiod* $B, cl(iid)
  est store t22
  qui reg ds5 MGIij polity_cov2 issuenij regij i_*i g_*i _Iregi* _Iperiod* $B, cl(iid)
  est store t23
  qui reg ds5 MGIij progeny issuenij regij i_*i g_*i _Iregi* _Iperiod* $B, cl(iid)
  est store t24
 
** Table A26 ** 
estout t2*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons) stat(N r2, fmt(0 3))

  
preserve
  collapse (max)var_*, by(shorti iid)
  
** Table A27 **
list shorti var_*
restore  
  

  g twc=cow2==1
 
  qui reg ds5 MGIij $A if twc==0, cl(iid)
  est store t31
  qui reg ds5 MGIij $A $B if twc==0, cl(iid)
  est store t32
  qui reg ds5 MGIij $A $B $C if twc==0, cl(iid)
  est store t33
  
** Table A28 **
estout t3*,  starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))


* Split sample analyses

  qui reg ds5 MGIij $A if global==1, cl(iid)
  est store t41
  qui reg ds5 MGIij $A $B if global==1, cl(iid)
  est store t42
  qui reg ds5 MGIij $A $B $C if global==1, cl(iid)
  est store t43
  qui reg ds5 MGIij $A if global==0, cl(iid)
  est store t44
  qui reg ds5 MGIij $A $B if global==0, cl(iid)
  est store t45
  qui reg ds5 MGIij $A $B $C if global==0, cl(iid)
  est store t46
  
** Table A29 **
estout t4*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*) stat(N r2, fmt(0 3))
  
  
  qui reg ds5 MGIij $A if nissuei==1, cl(iid)
  est store t51
  qui reg ds5 MGIij $A $B if nissuei==1, cl(iid)
  est store t52
  qui reg ds5 MGIij $A $B $C if nissuei==1, cl(iid)
  est store t53
  qui reg ds5 MGIij $A if nissuei>1, cl(iid)
  est store t54
  qui reg ds5 MGIij $A $B if nissuei>1, cl(iid)
  est store t55
  qui reg ds5 MGIij $A $B $C if nissuei>1, cl(iid)
  est store t56
 
** Table A30 **
estout t5*, starlevels(°  .1 * .05 ** .01 *** .001) cells(b(star fmt(3)) se(par fmt(3))) drop(_*) stat(N r2, fmt(0 3))


  egen ngovi=rowtotal(g_*i)
  su ngovi, d
  g sgov=ngovi<=2
  
  qui reg ds5 MGIij $A if sgov==1, cl(iid)
  est store t61
  qui reg ds5 MGIij $A $B if sgov==1, cl(iid)
  est store t62
  qui reg ds5 MGIij $A $B $C if sgov==1, cl(iid)
  est store t63
  qui reg ds5 MGIij $A if sgov==0, cl(iid)
  est store t64
  qui reg ds5 MGIij $A $B if sgov==0, cl(iid)
  est store t65
  qui reg ds5 MGIij $A $B $C if sgov==0, cl(iid)
  est store t66

** Table A31 **  
estout t6*, starlevels(° .1 * .05 ** .01 *** .001) cells(b(star fmt(3)) se(par fmt(3))) drop(_*) stat(N r2, fmt(0 3))


  qui reg ds5 MGIij $A if g7any==1, cl(iid)
  est store t71
  qui reg ds5 MGIij $A $B if g7any==1, cl(iid)
  est store t72
  qui reg ds5 MGIij $A $B $C if g7any==1, cl(iid)
  est store t73
  qui reg ds5 MGIij $A if g7any==0, cl(iid)
  est store t74
  qui reg ds5 MGIij $A $B if g7any==0, cl(iid)
  est store t75
  qui reg ds5 MGIij $A $B $C if g7any==0, cl(iid)
  est store t76

** Table A32 **  
estout t7*, starlevels(° .1 * .05 ** .01 *** .001) cells(b(star fmt(3)) se(par fmt(3))) drop(_*) stat(N r2, fmt(0 3))

 
  qui reg ds5 MGIij $A if postcw==1, cl(iid)
  est store t81
  qui reg ds5 MGIij $A $B if postcw==1, cl(iid)
  est store t82
  qui reg ds5 MGIij $A $B $C if postcw==1, cl(iid)
  est store t83
  qui reg ds5 MGIij $A if postcw==0, cl(iid)
  est store t84
  qui reg ds5 MGIij $A $B  if postcw==0, cl(iid)
  est store t85
  qui reg ds5 MGIij $A $B $C if postcw==0, cl(iid)
  est store t86

** Table A33 **  
estout t8*, starlevels(° .1 * .05 ** .01 *** .001) cells(b(star fmt(3)) se(par fmt(3))) drop(_*) stat(N r2, fmt(0 3))


